<?php
/**
 * JE Career package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

function com_install() {

	jimport('joomla.filesystem.folder');
	jimport("joomla.filesystem.file");
	$db			=& JFactory::getDBO();
	
	//Insert default configuration details
	$query 		= "SELECT count(*) FROM #__hostingraja_career_settings";
	$db->setQuery( $query );
	$total_rows = $db->loadResult();
	
	if(!$total_rows){
		$query 	= "INSERT INTO `#__hostingraja_career_settings` (`id`, `show_title`, `introtext`, `show_form`, `show_captcha`, `allow_reg`, `footer_text`, `user_email`, `admin_email`, `emailid`, `cat_perpage`, `group`, `sorting`, `file_format`, `description_default`, `career_title`)". 
															"VALUES(1, 1, 1, 1, 0, 0, 1, 0, 0, 'admin@yoursite.com', 5, 'id', 'asc', 'doc,pdf,txt,pptx', 'Description comes here', 'current openings')";
		$db->setQuery( $query );
		$db->query();
	}
	if (!JFolder::exists(JPATH_ADMINISTRATOR.DS.'upload_hostingrajacareer')) {
			JFolder::move(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_hostingrajacareer'.DS.'upload_hostingrajacareer',JPATH_ADMINISTRATOR.DS.'upload_hostingrajacareer');
	} else {
		JFolder::delete(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_hostingrajacareer'.DS.'upload_hostingrajacareer');
	}
}
?>

